<?php
/*
 * Created on 2011-1-15
 * by lixilei
 */

class FeedbackCtrl extends spController{
	
	/**
	 * 提交反馈信息
	 */
	public function submitFeedback(){
		// 获取参数
		$type = $_POST["type"];
		$content = trim($_POST["content"]);
		
		if($type == NULL || $type == "" || $content == NULL || $content == ""){
			$this->results = array("ret"=>_FAIL, "errMsg"=>_FEEDBACK_NULL);
			if(!empty($_SESSION["lexiang_login"]) && $_SESSION["lexiang_login"] == _SUCCESS){				
				$this->results += $_SESSION;
			}
			// 记录并调度信息
			$toURL = "feedback.htm";
			$dispatchBiz = spClass("DispatchBiz", null, BIZ_PATH."DispatchBiz.php");
			$dispatchBiz->recordDispatch($toURL, "FeedbackCtrl&submitFeedback&error&feedbackNull");
			$this->display($toURL);
			return;
		}
		
		// 执行业务
		$feedbackBiz = spClass("FeedbackBiz", null, BIZ_PATH."FeedbackBiz.php");
		$result = $feedbackBiz->recordFeedback($type, $content, $_SESSION["userInfo"]["user_id"]);
		
		// 结果处理
		if($result == FALSE){
			$this->results = array("ret"=>_FAIL, "errMsg"=>_UNKNOW_ERROR);
			if(!empty($_SESSION["lexiang_login"]) && $_SESSION["lexiang_login"] == _SUCCESS){				
				$this->results += $_SESSION;
			}
			// 记录并调度信息
			$toURL = "feedback.htm";
			$dispatchBiz = spClass("DispatchBiz", null, BIZ_PATH."DispatchBiz.php");
			$dispatchBiz->recordDispatch($toURL, "FeedbackCtrl&submitFeedback&error&unknowError");
			$this->display($toURL);
		} else{
			$this->results = array("ret"=>_FAIL, "errMsg"=>_FEEDBACK_SUCCESS);
			if(!empty($_SESSION["lexiang_login"]) && $_SESSION["lexiang_login"] == _SUCCESS){				
				$this->results += $_SESSION;
			}
			// 记录并调度信息
			$toURL = "feedback.htm";
			$dispatchBiz = spClass("DispatchBiz", null, BIZ_PATH."DispatchBiz.php");
			$dispatchBiz->recordDispatch($toURL, "FeedbackCtrl&submitFeedback&error&unknowError");
			$this->display($toURL);
		}
	}
}
?>
